home *** CD-ROM | disk | FTP | other *** search
- ======================================
-
- DOS & Don'ts -- Part 36
-
- by James Gregory Weiler
-
- ======================================
-
- ======================================
- Part 4: Directory blocks
- ======================================
-
-
- Each directory block consists of two
-
- parts: the directory link in bytes 0
-
- and 1, and the file directory section.
-
- The directory link gives the track
-
- and block number of the block where
-
- the directory continues.
-
- The file directory section, bytes 2
-
- through 255, has storage space for
-
- eight file names, each using thirty
-
- bytes. See map 4, below. The disk
-
- has 18 directory blocks, so you can
-
- store 144 (18 X 8) files on a disk.
-
-
- ======================================
- Map 4: A single directory sector.
-
- byte/contents
- --------------------------------------
- 0/Track of next directory block.
- Normally eighteen.
-
- 1/Block number of the next
- directory block. It normally
- equals this block plus three
- (or this block minus 14 if
- this block is greater than 15).
-
- 2-31 / File name 1
- 34-63 / File name 2
- 66-95 / File name 3
- 98-127 / File name 4 (see Map 5)
- 130-159 / File name 5 (far below)
- 162-191 / File name 6
- 194-223 / File name 7
- 226-255 / File name 8
- ======================================
-
- ======================================
- Part 5:directory file entries
- ======================================
-
- All of the 144 file name areas in
-
- the directory share the same
-
- structure. See map 5, far below.
-
- The first of the thirty bytes (byte
-
- zero) is the file type byte.
-
- The value of this byte defines the
-
- file type of this file entry.
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
- THE FILE TYPE BYTE:
-
- byte file
- value type typical file contents
- - - - - - - - - - - - - - - - - - - -
- 0 DEL none -- file scratched
- 129 SEQ text/data
- 130 PRG program/text/ml/data
- 131 USR text/data
- 132 REL text/data
- 1-127 - file not closed
- properly
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
- A file type byte with a value less
-
- than 128 means that this file was not
-
- properly closed. When the disk is
-
- validated, these "invalid" files will
-
- disappear.
-
- Bytes one and two are the track and
-
- block numbers of the first data block
-
- of the file.
-
- Bytes three through eighteen contain
-
- the file's name. If the name is less
-
- than sixteen bytes long, this area
-
- will be padded with shifted spaces.
-
- Bytes nineteen and twenty are only
-
- used by RELative files. They point to
-
- the file's first side sector. Side
-
- sectors keep track of where every part
-
- of a relative file is so you can read
-
- any record directly, without scanning
-
- all the way through the file.
-
- Byte twenty-one, also used only for
-
- relative files, is the record size.
-
- Bytes twenty-eight and twenty-nine
-
- tell us the number of blocks in the
-
- file. The block count can be figured
-
- by multiplying the contents of byte 29
-
- by 256 and adding the results to the
-
- contents of byte 28.
-
- ======================================
- Map 5: A single directory entry.
-
- byte contents
- --------------------------------------
- 0 File type byte.
- 1 Track of first data block.
- 2 Block # of first data block.
- 3-18 File name followed by shifted
- spaces.
- 19 Track of first side sector block
- 20 Block # of first side sector
- block.
- 21 Record size.
- 22-25 Unused
- 26-27 Block of replacement file when
- using save"@0:name" -- the save
- and replace syntax.
- 28-29 Number of blocks in the file.
-
- =======< continued in Part 37 >=======
-